/*
 * Singularity Engine
 * Copyright (C) 2010 Vyacheslav Vorobyov, All rights reserved.
 * See LICENSE for full license information.
 */

/**
 * 
 */
package org.singularity.mapred.model;

import org.singularity.mapred.Destination;
import org.singularity.mapred.Source;

/**
 * @author vjache
 *
 */
public abstract class Flow
{
	public static enum Code
	{
		MapFlow,
		OutputFlow;
	}
	
	protected final DefaultCascade _cascade;
	private final Source _src;
	private final Destination _dst;
	private final Code _flCode;
	private final Object _id;

	protected Flow(
			Code aFlCode,
			Object aId,
			DefaultCascade aCascade, 
			Source aSource, 
			Destination aDestination) 
	{
		_flCode = aFlCode;
		_id = aId;
		_cascade = aCascade;
		_src = aSource;
		_dst = aDestination;
	}

	/**
	 * @return the src
	 */
	public Source getSource() {
		return _src;
	}

	/**
	 * @return the dst
	 */
	public Destination getDestination() {
		return _dst;
	}

	/**
	 * @return the flCode
	 */
	public Code getFlowCode() {
		return _flCode;
	}

	/**
	 * @return the id
	 */
	public Object getId() {
		return _id;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("{");
		sb.append(" id:");
		sb.append(_id);
		sb.append(",");
		sb.append(" code:");
		sb.append(_flCode);
		sb.append("}");
		return sb.toString();
	}

}
